<%@include file="inc/prelude.jsp" %>
<div id="wrapper">
    <%@include file="inc/header.jsp" %>
    <%@include file="inc/menu.jsp" %>
    <script type="text/javascript" >
        $(document).ready(function() {

            $(function() {
                $("#date_from").datepicker( {
                    showOn: 'button',
                    buttonImage: '../res/images/calendar.gif',
                    buttonImageOnly: true,
                    dateFormat: 'yy-mm-dd' //ISO 8601
                });
            });
            $(function() {
                $("#date_to").datepicker( {
                    showOn: 'button',
                    buttonImage: '../res/images/calendar.gif',
                    buttonImageOnly: true,
                    dateFormat: 'yy-mm-dd' //ISO 8601
                });
            });
        });
    </script>
    <div id="content">
        <div class="content-transaction">
            <div id="table-trans">
                <div class="head-trans">
                    <form name="history_search_form" action="/user/doHistory.htm" method="POST">
                        <div class="head-trans-in">
                            <div class="head-trans-in2">
                                <div class="trans-title"><s:text name="user.history.title" /></div>
                                <div class="trans-search">
                                    <div class="date-from"><s:text name="user.history.datefrom" /></div>
                                    <div class="date-to"><s:text name="user.history.dateto" /></div>
                                    <div class="show"><s:text name="user.history.show" /></div>
                                    <div class="search-button"></div>
                                    <div class="clearboth"></div> 
                                    <div class="date-from">
                                        <s:textfield id="date_from" maxLength="16" name="date_from" readonly="true" size="16" />
                                    </div>
                                    <div class="date-to">
                                        <s:textfield id="date_to" maxLength="16" name="date_to" readonly="true" size="16" />
                                    </div>
                                    <div class="show">
                                        <s:select name="search" list="searchList" listKey="id" listValue="value" />
                                    </div>
                                    <div class="search-button"><input onclick="document.history_search_form.submit();" type="button"></div>
                                    <div class="clearboth"></div>
                                </div>
                            </div>
                        </div>
                    </form>

                </div>
                <div class="list-trans">
                    <table class="table1" id="table2" width="100%" border="0" cellpadding="0" cellspacing="0">
                        <tbody>
                            <tr style="border-bottom: 1px solid rgb(204, 204, 204);">
                                <th style="text-align: center"><s:text name="user.history.id" /></th>
                                <th style="text-align: center"><s:text name="user.history.date" /></th>
                                <th style="text-align: center"><s:text name="user.history.type" /></th>                                
                                <th style="text-align: center"><s:text name="user.history.recipient" /></th>
                                <th style="text-align: right"><s:text name="user.history.amount" /></th>                                
                                <th style="text-align: center"><s:text name="user.history.status" /></th>
                            </tr>
                            <c:if test="${requestScope['trans'] != null}">
                                <c:forEach items="${requestScope['trans']}" var="tran">
                                    <c:if test="${tran.account.currencyCode == 840}">
                                        <c:set var="curr" value="USD" />
                                    </c:if>
                                    <c:if test="${tran.account.currencyCode == 858}">
                                        <c:set var="curr" value="$U" />
                                    </c:if>
                                    <c:if test="${tran.account.currencyCode == 032}">
                                        <c:set var="curr" value="ARG" />
                                    </c:if>
                                    <tr class="alt_line">
                                        <td style="text-align: center">${tran.transaction.id}</td>
                                        <td style="text-align: center">${tran.transaction.postDate}</td>
                                        <td style="text-align: center">${tran.transaction.type}</td>
                                        <td style="text-align: center">${tran.transaction.dest}</td>
                                        <c:if test="${tran.increase}">
                                            <td style="color: green;text-align: right">+${tran.amount} ${curr}</td>
                                        </c:if>
                                        <c:if test="${tran.decrease}">
                                            <td style="color: red;text-align: right">-${tran.amount} ${curr}</td>
                                        </c:if>
                                        <td style="text-align: center">${tran.transaction.status}</td>
                                    </tr>
                                </c:forEach>
                            </c:if>

                        </tbody>
                    </table>
                    <div class="pagination" style="padding: 1px; margin-top: 10px; margin-bottom: 10px;"><a href="https://www.flocash.com/nbank/history.do?page=1" style="margin: 1px; padding: 1px 3px; border: 1px solid rgb(204, 204, 204); font-weight: bold;" ;="">First</a><a href="https://www.flocash.com/nbank/history.do?page=1" style="margin: 1px; padding: 1px 3px; border: 1px solid rgb(204, 204, 204); font-weight: bold;" ;="">Last</a></div>
                </div>
            </div>
        </div>
    </div>
    <%@include file="inc/footer.jsp" %>
</div>
<%@include file="inc/coda.jsp" %>